#include<iostream>
using namespace std;
int main(){
	int x; 
	cin>>x;
	int m,n,r;
	m=n=r=x;
	int sum1=0,sum2=0,sum3=0,sum4=0;
	for(;x;x/=10){
		sum1+=x%10;
	}
	cout<<sum1<<" "<<1<<endl;
	while(m>0){
		sum2+=m%10;
		m/=10;
	}
	cout<<sum2<<" "<<2<<endl;
	do{
		sum3+=n%10;
		n/=10;
	}
	while(n);
	cout<<sum3<<" "<<3<<endl;
	while(1){
		if(r>0){
			sum4+=r%10;
			r/=10;
		}
		else{
			break;
		}
	}
	cout<<sum4<<" "<<4<<endl;
	return 0;
} 
